<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Host</title>
<spring:url value="/resources" var="resUrl" />
<spring:url value="/admin" var="adminUrl" />
<link rel="stylesheet" href="${resUrl}/common.css" type="text/css"></link>
<script>
	dojoConfig = {
		packages : [ {
			name : "mydojo",
			location : "${resUrl}/js/mydojo"
		} ],
		async : true,
		isDebug : true,
		hostId: "${host.id}"
	};
</script>
<script
	src="http://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.js"></script>
<script>
	// Don't access DOM until ready
	require([ "mydojo/hostsCharting", "dojo/domReady!" ],
			function(ch) {
				ch.placeCpuChart("chart-cpu");
				ch.placeMemChart("chart-mem");
			});
</script>
<script src="${resUrl}/js/mydojo/hostsCharting.js"></script>

</head>
<body>

	<h1>Host: ${host.hostname}</h1>

	<div class="parmChunk">
		<div class="parmLabel">Connection Status</div>
		<div>
			${host.connectionStatus}
			<c:if test="${not empty host.statusMessage}">
							, ${host.statusMessage}
							</c:if>
		</div>
		<div>
			<a href="${adminUrl}/hosts/${host.id}/check">Re-check</a>
		</div>
	</div>

	<div class="parmChunk">
		<div class="parmLabel">Processors</div>
		<div>${host.processors}</div>
	</div>

	<div class="parmChunk">
		<div class="parmLabel">Total Memory</div>
		<div>${host.totalMemory} MB</div>
	</div>

	<div class="parmChunk">
		<div class="parmLabel">Web Service Port</div>
		<div>${host.wsPort}</div>
	</div>

	<div class="parmChunk">
		<div class="parmLabel">Web Service Username</div>
		<div>${host.wsUsername}</div>
	</div>

	<div class="buttonStrip">
		<form action="${adminUrl}/hosts/${host.id}" method="post">
			<input type="hidden" name="_method" value="DELETE"></input> <input
				type="submit" value="Delete"></input>
		</form>
	</div>
	
	<div id="charts">
	<div id="chart-cpu" class="chart">
	</div>
	<div id="chart-mem" class="chart">
	</div>
	</div>
</body>
</html>
